var contextPath = "http://localhost:9090/aa"
axios.defaults.timeout = 5000
axios.defaults.baseURL = contextPath + "/api"


function fetch(callback, url, method, data){
	if(!method){
		method = "post";
	}
	axios.request({
		url : url,
		method : method,
		data : data
	})
	.then(function(res){
		 if (res.status >= 200 && res.status < 300) {
			 console.log(res.data)
			 callback(res.data)
         }
	 })
	 .catch((error) => {
         console.log("Error when calling: " + url);
         return Promise.reject(error)
     });
}